package com.xudow.app.newui.fragment;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.activeshare.edu.ucenter.models.base.AgencySchools;
import com.activeshare.edu.ucenter.models.course.CourseDailyRecommendWithCourse;
import com.activeshare.edu.ucenter.models.course.CourseSearchCriteriaLevelOneWithOthers;
import com.activeshare.edu.ucenter.models.searchcriteria.CourseSearchCriteriaLevelThreeWithOthers;
import com.activeshare.edu.ucenter.models.searchcriteria.CourseSearchCriteriaLevelTwoWithOthers;
import com.baidu.location.LocationClient;
import com.google.gson.Gson;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.xudow.app.Config;
import com.xudow.app.R;
import com.xudow.app.XApplication;
import com.xudow.app.data.Pair;
import com.xudow.app.dynamicstate_old.domain.entity.AttentionType;
import com.xudow.app.dynamicstate_old.module.follow.NewDynamicActivity;
import com.xudow.app.network.AjaxCallBack;
import com.xudow.app.network.OkHttpClientManager;
import com.xudow.app.newui.EditKeyWordActivity;
import com.xudow.app.newui.PreLoginActivity;
import com.xudow.app.newui.adapter.CanPinAdapter;
import com.xudow.app.newui.adapter.FuJin2Adapter;
import com.xudow.app.newui.adapter.FuJinAdapter;
import com.xudow.app.newui.adapter.NianJiAdapter;
import com.xudow.app.newui.adapter.NinajiBneDiAdapter;
import com.xudow.app.newui.adapter.XiaoQu2Adapter;
import com.xudow.app.newui.adapter.XiaoQuAdapter;
import com.xudow.app.newui.base.BaseUiFragment;
import com.xudow.app.newui.bean.CanPin;
import com.xudow.app.newui.bean.FuJin;
import com.xudow.app.newui.bean.FuJin2;
import com.xudow.app.newui.bean.NianJi;
import com.xudow.app.newui.bean.TownEntity;
import com.xudow.app.newui.bean.XiaoQu;
import com.xudow.app.newui.view.GridViewForScrollView;
import com.xudow.app.newui.zutils.SystemBarTintManager;
import com.xudow.app.ui.CartActivity;
import com.xudow.app.ui.CourseDetailActivity;
import com.xudow.app.ui.CourseFilterPopupWindow;
import com.xudow.app.ui.CourseListFragment;
import com.xudow.app.ui.CourseLocationPopupWindow;
import com.xudow.app.ui.adapter.CourseFilterMenuAdapter;
import com.xudow.app.ui.task.DailyRecommendCoursesTask;
import com.xudow.app.ui.task.SearchLevalTask;
import com.xudow.app.ui.widget.gallery.XViewPaper;
import com.xudow.app.util.ImageUtils;
import com.xudow.app.util.NetworkUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;

/**
 * 作者：zhouXJ on 2016/4/5 15:10
 * 课程
 */

public class CourseFragment extends BaseUiFragment implements CourseFilterPopupWindow.CourseFilterListener,
         View.OnClickListener {
        private LayoutInflater inflater;
        private List<AgencySchools> agencyshools;//大帝学校列表
        private PopupWindow artSportMenu;
        private PopupWindow cultureMenu;
        public static int SEARCHR_REQUEST_CODE=85;//搜索返回码
        private String keyword;//搜索关键字
        private boolean hasrecommed_course=false;//有推荐课程标识
        private TextView sortTextView;

        //文化课view
        private TextView cultureTitle;
        private ImageView cultureIcon;

        private EditText keywordEditText;
        private RelativeLayout rootLayout;
        private RelativeLayout headerBarLayout;

        /**
         * 筛选弹出
         */
        private CourseFilterPopupWindow filterPopupWindow;
        private CourseLocationPopupWindow courseLocationPopupWindow,courseLocationPopupWindow2;

        private String currentAreaName; //当前区域名
        private String currentAreaValue; //当前区域值
        private String currentAgencySchoolId;//当前大帝区域学校ID

        /**
         * 排序
         */
        public static final int SORT_OPTION_DEFAULT = 0; //默认
        public static final int SORT_OPTION_LATEST = 1;  //开课时间最近
        public static final int SORT_OPTION_NEARBY = 2;  //地点离我最近
        private int currentSortOption = SORT_OPTION_DEFAULT;

        /**
         * 3级选项
         */
        private List<Pair> courmenuOptions02,artmenuOptions0, menuOptions1, menuOptions2;
        private Pair oneselected,twoselected,threeselected;
         private CourseListFragment courseListFragment;
        List<CourseSearchCriteriaLevelOneWithOthers> list;//分类列表
        //当前筛选项
        private static final int CURRENT_FILTER_ART_APORT = 1; //艺体类
        private static final int CURRENT_FILTER_CULTRAL = 2;  //文化类
        private int currentFilter;

        //筛选条件
        private String levelOneSelected;
        private String levelTwoSelected;
        private String levelThreeSelected;

        String name;
        //课程类别
        private String course_type;//0为艺术 1为文化
        private  LinearLayout shaixuanll;

        @BindView(R.id.art_sort_ll)
        LinearLayout art_sort_ll;

        @BindView(R.id.filter_sort_ll)
        LinearLayout filter_sort_ll;//筛选

        @BindView(R.id.shopping_cartl_iv)
        ImageView shopping_cartl_iv;

        @BindView(R.id.title_search_iv)
        RelativeLayout title_search_iv;


        @BindView(R.id.clean_keyword_tv)
        TextView clean_keyword_tv;

        @BindView(R.id.keyword_tv)
        TextView keyword_tv;
    @BindView(R.id.shaixuan_iv)
    ImageView shaixuan_iv;
    @BindView(R.id.shaixuan)
    TextView shaixuan;
         View v;

        LinearLayout ll_fujin;
        TextView tv_fujin;
        ImageView iv_fujin;


      LocationClient locationClient;
    Button bt_listitem;
    String jgid,xqid;
    ImageView sort_iv;
    ImageView xfgouwuche;
        @Override
        public View onCreateView(LayoutInflater inflater,  ViewGroup container,  Bundle savedInstanceState) {
            v= inflater.inflate(R.layout.activity_course_search, container, false);

            currentAreaName = getString(R.string.no_limit);

            rootLayout = (RelativeLayout)v.findViewById(R.id.root);
            headerBarLayout = (RelativeLayout) v.findViewById(R.id.header_bar);
            keywordEditText = (EditText) v.findViewById(R.id.keyword);
            shaixuanll=(LinearLayout)v.findViewById(R.id.shaixuanll);
            shaixuanll.setOnClickListener(this);
            sortTextView = (TextView) v.findViewById(R.id.sort);
//            artSp   ortTitle = (TextView) v.findViewById(R.id.art_sport_title);
            sort_iv = (ImageView) v.findViewById(R.id.sort_iv);

            ll_fujin=(LinearLayout)v.findViewById(R.id.ll_fujin);
            tv_fujin=(TextView)v.findViewById(R.id.tv_fujin);
            iv_fujin=(ImageView)v.findViewById(R.id.iv_fujin);
            ll_fujin.setOnClickListener(this);

            cultureTitle = (TextView) v.findViewById(R.id.culture_title);
            cultureIcon = (ImageView) v.findViewById(R.id.culture_icon);
            xfgouwuche=(ImageView)v.findViewById(R.id.xfgouwuche);
            xfgouwuche.setOnClickListener(this);
            //每日课程推荐
            xViewPaperDailyRecommend = (XViewPaper) v.findViewById(R.id.course_ad_gallery);
            advLayoutDailyRecommend = (RelativeLayout) v.findViewById(R.id.course_ad);
            keid();
            courseListFragment = (CourseListFragment)
                    getChildFragmentManager().findFragmentById(R.id.course_fragment);
            bt_listitem=(Button)v.findViewById(R.id.bt_listitem);

            bt_listitem.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    tv_fujin.setText("附近");
                    cultureTitle.setText("科目");
                    sortTextView.setText("排序");
                    jgid=null;
                    xqid=null;
                    levelOneSelected = "0";
                    levelTwoSelected = "0";
                    levelThreeSelected = "0";


                    courseListFragment.setLevelOneSelected(null);
                    courseListFragment.setLevelTwoSelected(null);
                    courseListFragment.setLevelThreeSelected(null);
                    courseListFragment.setac(null);
                    keyword_tv.setText(null);

                    courseListFragment.setKeyword("");
                    courseListFragment.setSearchtype(null);
                    courseListFragment.setSorttype(null);
                    courseListFragment.setCourse_type(null);
                    course_type=null;

                    searchtype=null;
                    sorttype=null;
                    latitude=0;
                    longitude=0;
                    keyword = "";

                    courseListFragment.setlatitude(0);
                    courseListFragment.setlongitude(0);
                    courseListFragment.setname(null);

                    courseListFragment.setleaveType(null);
                    courseListFragment.settypesTwoname(null);


                    courseListFragment.gradeids=buffer2.toString();
                    courseListFragment.loadCourses("穿穿穿", null, null, null,null,null,null,null,"353",null,null,null,null,null);
                }
            });


//        getLeveList(buffer.toString());
            courseListFragment.gradeids=buffer2.toString();
            courseListFragment.loadCourses("穿穿穿", null, null, null, null, null, null, null, "353", null, null, null, null, null);


            return v;
        }
    StringBuffer buffer;
    StringBuffer buffer2;
    private void keid() {
         buffer=new StringBuffer();
         buffer2=new StringBuffer();
        SharedPreferences preference = getActivity().getSharedPreferences("guanzhuid", Context.MODE_PRIVATE);

        int datasize = preference.getInt("datasize", 0);

        for(int i=0;i<datasize;i++){
            int datagetId = preference.getInt("datagetId"+i, 0);

            buffer.append(datagetId+",");
        }
                if( buffer.length()!=0){
  buffer.deleteCharAt(buffer.length()-1);
                 }


        SharedPreferences preference2 = getActivity().getSharedPreferences("nianjiid", Context.MODE_PRIVATE);

        int datasize2 = preference2.getInt("datasize", 0);

        for(int i=0;i<datasize2;i++){
            int datagetId2 = preference2.getInt("datagetId"+i, 0);

            buffer2.append(datagetId2+",");
        }
        if( buffer2.length()!=0){
            buffer2.deleteCharAt(buffer2.length()-1);
        }


    }


    public void updategrids(){
    if(tv_fujin!=null){
        tv_fujin.setText("附近");
        cultureTitle.setText("科目");
        sortTextView.setText("排序");

        keid();
//      getLeveList(buffer.toString());
        courseListFragment.gradeids=buffer2.toString();
        courseListFragment.loadCourses("穿穿穿", null, null, null, null, null, null, null, "353", null, null, null, null, null);
    }

    }

    /**
     * 初始化筛选数据
     */
    private void initSearchList() {
            artmenuOptions0=new ArrayList<Pair>();
        Pair all=new Pair();
        all.one=new CourseSearchCriteriaLevelOneWithOthers();
        all.one.setId(0L);
        all.one.setName("全部");
        artmenuOptions0.add(all);

        for (CourseSearchCriteriaLevelOneWithOthers cone : list) {
            Pair p = new Pair();

                p.one = cone;

                artmenuOptions0.add(p);
        }
        onArtSportMenuClick(ov);
    }

    private void getLeveList(String bf) {
//    XApplcation application = (XApplication) getActivity().getApplication();
//    if (!application.isLogin()) {

        HashMap<String,String> map=new HashMap<String, String>();

        map.put("gradeids",buffer2.toString());
//        map.put("subjectids", subjectids.substring(1, subjectids.length() - 1));

        map.put("attentioncodes", bf);
        if (NetworkUtils.isNetWorkConnected(getContext())) {
            SearchLevalTask searchLevalTask = new SearchLevalTask(getContext(), searchLevelHandler);
            getMyAct().addTask(searchLevalTask);
            searchLevalTask.execute(map);
//            showLodingDialog("加载分类");
        }else{
            getApp().makeToast("亲 没网了");
        }

    }


    /**
     * searchlevel handler
     */
    private Handler searchLevelHandler=new Handler(){
        @Override
        public void handleMessage(Message msg) {
            hideLoadingDialog();
            super.handleMessage(msg);
            if (msg.what== SearchLevalTask.SUCCESS){
                list=(List <CourseSearchCriteriaLevelOneWithOthers>)(msg.obj);
                List<CourseSearchCriteriaLevelOneWithOthers> list0=new ArrayList<>();
                List<CourseSearchCriteriaLevelOneWithOthers> list1=new ArrayList<>();
                for(int i=0;i<list.size();i++){

                    if(list.get(i).getType()==0){
                        list0.add(list.get(i));
                    }else{
                        list1.add(list.get(i));
                    }

                }

                list.clear();
                for(int i=0;i<list0.size();i++){
                    list.add(list0.get(i));
                }
                for(int i=0;i<list1.size();i++) {
                    list.add(list1.get(i));
                }
                initSearchList();
            }else{
                //                getApp().makeToast(msg.getData().getString("errMessage"));
            }
        }
    };
        /**
         * 搜索
         *
         * @param isPopupClick 是不是弹出窗口的确定按钮点击
         */
        private void startSearch(boolean isPopupClick) {
            if (!isPopupClick) {
                //恢复弹出窗口选项
                currentAreaValue = null;
                currentAreaName = null;
                currentAgencySchoolId=null;
                currentSortOption = SORT_OPTION_DEFAULT;
            }
            if ("0".equals(levelOneSelected))
                courseListFragment.setLevelOneSelected(null);
            else
                courseListFragment.setLevelOneSelected(levelOneSelected);

            if ("0".equals(levelTwoSelected)) {
                courseListFragment.setLevelTwoSelected(null);
            } else {
                courseListFragment.setLevelTwoSelected(levelTwoSelected);
            }

            if ("0".equals(levelThreeSelected)) {
                courseListFragment.setLevelThreeSelected(null);
            } else {
                courseListFragment.setLevelThreeSelected(levelThreeSelected);
            }

//            if (!TextUtils.isEmpty(keyword)) {
                    courseListFragment.setKeyword(keyword);
//            }

            courseListFragment.setSearchtype(searchtype);

                courseListFragment.setSorttype(sorttype);
            if (null!=course_type)
                courseListFragment.setCourse_type(course_type);
            else
                courseListFragment.setCourse_type(null);
            courseListFragment.setAreaId(currentAreaValue);
            courseListFragment.setAgencySchoolId(currentAgencySchoolId);
            courseListFragment.setSortOption(currentSortOption);

            courseListFragment.setlongitude(longitude);
            courseListFragment.setlatitude(latitude);
//            courseListFragment.ccc="不在清理数据"
//            if(keyword==null){
                courseListFragment.loadCourses("不在清理数据",null,null,null,null,null,null,null,"年级",null,null,null,null,null);
//            }


        }



        @Override
        protected void initData() {
            //加载每日课程推荐
            DailyRecommendCoursesTask dailyRecommendCoursesTask = new DailyRecommendCoursesTask(getActivity(), dailyRecommendCoursesTaskHandler);
            dailyRecommendCoursesTask.execute(new HashMap<String, String>());


        }

        /**
         * 每日课程推荐Handler
         */
        private RelativeLayout advLayoutDailyRecommend;
        private List<CourseDailyRecommendWithCourse> dailyRecommends;
        private int adheight;
        private Handler dailyRecommendCoursesTaskHandler = new Handler() {
            @Override
            public void handleMessage(Message msg) {
                if (DailyRecommendCoursesTask.SUCCESS == msg.what) {
                    CourseDailyRecommendWithCourse[] dataArr =
                            (CourseDailyRecommendWithCourse[]) msg.getData().getSerializable("courses");

                    if (null == dataArr || dataArr.length <= 0) {
                        return;
                    }

                    dailyRecommends = new ArrayList<CourseDailyRecommendWithCourse>();
                    dailyRecommends.addAll(Arrays.asList(dataArr));

                    initDailyRecommendViewPager();

                    advLayoutDailyRecommend.setVisibility(View.VISIBLE);
                    //标记是否有课程推荐
                    hasrecommed_course=true;
                    //获取推荐布局高度
                    adheight=advLayoutDailyRecommend.getHeight();


                }
            }
        };
        /**
         * 设置课程推荐广告图片
         */
        private XViewPaper xViewPaperDailyRecommend;
        private List<View> listViewsDailyRecommend;
        private void initDailyRecommendViewPager() {
            listViewsDailyRecommend = new ArrayList<View>();

            for (int i = 0; i < dailyRecommends.size(); i++) {
                final CourseDailyRecommendWithCourse courseRecommended = dailyRecommends.get(i);

                if (getActivity() == null) {
                    return;
                }
                ImageView imageView = new ImageView(getActivity());
                imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                imageView.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        Intent intent = new Intent(getActivity(), CourseDetailActivity.class);
                        intent.putExtra("courseId", courseRecommended.getCourseId());
                        startActivity(intent);
                    }
                });
                String imageUrl = String.format(Config.IMAGE_LOAD_URL_PARAMS, courseRecommended.getImgPath());
//                ImageUtils.loadImage(getActivity(), imageView, imageUrl, R.mipmap.empty);
                ImageLoader.getInstance().displayImage(imageUrl,imageView);

                listViewsDailyRecommend.add(imageView);
            }

            xViewPaperDailyRecommend.start(getActivity(), listViewsDailyRecommend, 4000, null,
                    R.layout.ad_bottom_item, R.id.ad_item_v,
                    R.drawable.dot_focused, R.drawable.dot_normal);
        }
    private Context context = null;
        @Override
        protected void initListener() {

            art_sort_ll.setOnClickListener(this);
//            coulture_sort_ll.setOnClickListener(this);
            filter_sort_ll.setOnClickListener(this);
            shopping_cartl_iv.setOnClickListener(this);
            title_search_iv.setOnClickListener(this);
            clean_keyword_tv.setOnClickListener(this);
            context=getActivity();
            courseListFragment.setHildListener(hildlistener);
        }

        private String searchtype, sorttype;
        private double  latitude, longitude;
        /**
         * 筛选PopupWindow确定按钮点击事件
         */
        @Override
        public void onSearchClick(String searchtype,String sorttype,double  latitude, double longitude) {

            this.searchtype=searchtype;
            this.sorttype=sorttype;
            this.latitude=latitude;
            this.longitude=longitude;

            updataTitle();

            course_type=null;
            startSearch(true);
        }

        private void updataTitle() {
            if (null==searchtype&&null==sorttype)
                sortTextView.setText("智能排序");
            else if(null==sorttype&&searchtype.equals("1"))
                sortTextView.setText("老师");
            else if(null==sorttype&&searchtype.equals("2"))
                sortTextView.setText("机构");
            else if (null==searchtype&&sorttype.equals("1")) {
                sortTextView.setText("离我最近");
            }else if (null==searchtype&&sorttype.equals("2"))
                sortTextView.setText("人气最高");
            else if (null==searchtype&&sorttype.equals("3"))
                sortTextView.setText("价格最低");
        }


   public int schoolId;
    public int agencyId;

    private PopupWindow popupWindow;
    private int from = 0;
    String sxcz;
    View ov;
    private static final String  SEARCH_LEVEL_LIST_URL = Config.BASE_URL + Config.SEARCH_LEVEL_LIST_URL;
    @Override
        public void onClick(View v) {
            switch (v.getId()){
                case R.id.clean_keyword_tv://清除关键字
                    if (!TextUtils.isEmpty(keyword_tv.getText())){

                        keyword_tv.setText(null);
                        keyword = "";
                        courseListFragment.setKeyword("");
                        levelOneSelected = "0";
                        levelTwoSelected = "0";
                        levelThreeSelected = "0";
                        course_type=null;
                        startSearch(false);

                    }
                    break;

                case R.id.art_sort_ll://科目
             showLodingDialog("正在加载...");
                    buffer=null;
                   buffer2=null;
                    list=null;
                    try {
                        keid();
                        ov=v;
                        courseListFragment.setname(null);
                        cultureTitle.setTextColor(Color.parseColor("#6DB93D"));
                        cultureIcon.setImageResource(R.mipmap.shaixuanxuanzhong);
                        getLeveList(buffer.toString());

                    }catch (Exception e){
                    }
                    break;
                case R.id.ll_fujin://附近
                    tv_fujin.setTextColor(Color.parseColor("#6DB93D"));
                    iv_fujin.setImageResource(R.mipmap.shaixuanxuanzhong);
                    AddressMenuClick(v);

                    break;
                case R.id.filter_sort_ll://排序
                    sortTextView.setTextColor(Color.parseColor("#6DB93D"));
                    sort_iv.setImageResource(R.mipmap.shaixuanxuanzhong);
                    onFilterClick(v);
                    break;
                case R.id.shaixuanll://筛选
                     shaixuan_iv.setImageResource(R.mipmap.shaixuanxuanzhong);

                     shaixuan.setTextColor(Color.parseColor("#6DB93D"));
                     sxcz="从筛选点击";
                    initPopupWindow("ss",this.jgid,this.xqid);
                    break;
                case R.id.xfgouwuche://购物车
                    XApplication application = getApp();
                    if (!application.isLogin()) {
                        Intent intent = new Intent(getMyAct(), PreLoginActivity.class);
                        intent.putExtra("closeAfterLogin", true);
                        startActivity(intent);
                        return;
                    }else{
                        Intent intent=new Intent(getMyAct(),CartActivity.class);
                        startActivity(intent);
                    }
                    break;
                case R.id.title_search_iv://标题栏搜索点击
                    // TODO title_search_iv
                    startActivityForResult(new Intent(getMyAct(), EditKeyWordActivity.class),SEARCHR_REQUEST_CODE);
                    break;

            }

        }
    /**
     * 添加新笔记时弹出的popWin关闭的事件，主要是为了将背景透明度改回来
     *
     */
    class popupDismissListener implements PopupWindow.OnDismissListener{

        @Override
        public void onDismiss() {
            backgroundAlpha(1f);
            shaixuan_iv.setImageResource(R.mipmap.ic_course_search_arrow_down);

            shaixuan.setTextColor(Color.parseColor("#000000"));
        }

    }

    protected void initPopupWindow(String xqxy,String s, String s1){
        View popupWindowView = LayoutInflater.from(context).inflate(R.layout.pop, null);
        //内容，高度，宽度
        WindowManager wm = (WindowManager) getActivity()
                .getSystemService(Context.WINDOW_SERVICE);

//        WindowManager wm = getActivity().getWindowManager();
        int width = wm.getDefaultDisplay().getWidth();

        int i= (int) (width/1.3);
        popupWindow = new PopupWindow(popupWindowView, i, LayoutParams.FILL_PARENT, true);

        //动画效果
        popupWindow.setAnimationStyle(R.style.AnimationRightFade);

        //菜单背景色
        ColorDrawable dw = new ColorDrawable(0xffffffff);
        popupWindow.setBackgroundDrawable(dw);

        //显示位置
       popupWindow.showAtLocation(v, Gravity.RIGHT, 0, 500);
        //    popupWindow.showAtLocation(v, Gravity.NO_GRAVITY, location[0]+v.getWidth(), location[1]);
        //设置背景半透明
        backgroundAlpha(0.5f);
        //关闭事件
        popupWindow.setOnDismissListener(new popupDismissListener());

        v.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
//                if (popupWindow != null) {
//                    popupWindow.dismiss();
//                    popupWindow = null;
//                }
                // 这里如果返回true的话，touch事件将被拦截
                // 拦截后 PopupWindow的onTouchEvent不被调用，这样点击外部区域无法dismiss
                return true;
            }
        });
        popupView(xqxy,popupWindowView,s1,s);

    }

    private void popupView(String xqxy,View popupWindowView,String sid,String jgid) {
        RelativeLayout canpinmaosu=(RelativeLayout)popupWindowView.findViewById(R.id.canpinmaosu);
        RelativeLayout rlxueqi=(RelativeLayout)popupWindowView.findViewById(R.id.rlxueqi);


        LinearLayout ll_week=(LinearLayout)popupWindowView.findViewById(R.id.ll_week);
        LinearLayout ll_time=(LinearLayout)popupWindowView.findViewById(R.id.ll_time);
        LinearLayout ll_nianji=(LinearLayout)popupWindowView.findViewById(R.id.ll_nianji);
        LinearLayout ll_jiage=(LinearLayout)popupWindowView.findViewById(R.id.ll_jiage);
        LinearLayout ll_xueqi=(LinearLayout)popupWindowView.findViewById(R.id.ll_xueqi);
        LinearLayout ll_canpin=(LinearLayout)popupWindowView.findViewById(R.id.ll_canpin);
        LinearLayout ll_banji=(LinearLayout)popupWindowView.findViewById(R.id.ll_banji);

        FrameLayout fl_week=(FrameLayout)popupWindowView.findViewById(R.id.fl_week);
        FrameLayout fl_time=(FrameLayout)popupWindowView.findViewById(R.id.fl_time);
        FrameLayout fl_nianji=(FrameLayout)popupWindowView.findViewById(R.id.fl_nianji);
        FrameLayout fl_jiage=(FrameLayout)popupWindowView.findViewById(R.id.fl_jiage);
        FrameLayout fl_xueqi=(FrameLayout)popupWindowView.findViewById(R.id.fl_xueqi);
        FrameLayout fl_canpin=(FrameLayout)popupWindowView.findViewById(R.id.fl_canpin);
        FrameLayout fl_banji=(FrameLayout)popupWindowView.findViewById(R.id.fl_banji);

        TextView zhouji=(TextView)popupWindowView.findViewById(R.id.zhouji);
        TextView zhouri=(TextView)popupWindowView.findViewById(R.id.zhouri);
        TextView zhouliu=(TextView)popupWindowView.findViewById(R.id.zhouliu);
        TextView zhouyi=(TextView)popupWindowView.findViewById(R.id.zhouyi);
        TextView zhouer=(TextView)popupWindowView.findViewById(R.id.zhouer);
        TextView zhousan=(TextView)popupWindowView.findViewById(R.id.zhousan);
        TextView zhousi=(TextView)popupWindowView.findViewById(R.id.zhousi);
        TextView zhouwu=(TextView)popupWindowView.findViewById(R.id.zhouwu);

        TextView shijian1=(TextView)popupWindowView.findViewById(R.id.shijian1);
        TextView shijian2=(TextView)popupWindowView.findViewById(R.id.shijian2);
        TextView shijian3=(TextView)popupWindowView.findViewById(R.id.shijian3);
        TextView shijian4=(TextView)popupWindowView.findViewById(R.id.shijian4);
        TextView shijian5=(TextView)popupWindowView.findViewById(R.id.shijian5);
        TextView shijian6=(TextView)popupWindowView.findViewById(R.id.shijian6);
        TextView time=(TextView)popupWindowView.findViewById(R.id.time);

        TextView chuyi=(TextView)popupWindowView.findViewById(R.id.chuyi);
        TextView chuer=(TextView)popupWindowView.findViewById(R.id.chuer);
        TextView chusan=(TextView)popupWindowView.findViewById(R.id.chusan);
        TextView gaoyi=(TextView)popupWindowView.findViewById(R.id.gaoyi);
        TextView gaoer=(TextView)popupWindowView.findViewById(R.id.gaoer);
        TextView gaosan=(TextView)popupWindowView.findViewById(R.id.gaosan);
        TextView nianji=(TextView)popupWindowView.findViewById(R.id.nianji);
        TextView nianji_gengduo=(TextView)popupWindowView.findViewById(R.id.nianji_gengduo);
     TextView nianjiid=(TextView)popupWindowView.findViewById(R.id.nianjiid);
        GridViewForScrollView nianji_gd=(GridViewForScrollView)popupWindowView.findViewById(R.id.nianji_gd);

        TextView jiage1=(TextView)popupWindowView.findViewById(R.id.jiage1);
        TextView jiage2=(TextView)popupWindowView.findViewById(R.id.jiage2);
        TextView jiage3=(TextView)popupWindowView.findViewById(R.id.jiage3);
        TextView jiage4=(TextView)popupWindowView.findViewById(R.id.jiage4);
        TextView jiage=(TextView)popupWindowView.findViewById(R.id.jiage);

        TextView xueqi1=(TextView)popupWindowView.findViewById(R.id.xueqi1);
        TextView xueqi2=(TextView)popupWindowView.findViewById(R.id.xueqi2);
        TextView xueqi3=(TextView)popupWindowView.findViewById(R.id.xueqi3);
        TextView xueqi4=(TextView)popupWindowView.findViewById(R.id.xueqi4);
        TextView xueqi=(TextView)popupWindowView.findViewById(R.id.xueqi);

        TextView canpin=(TextView)popupWindowView.findViewById(R.id.canpin);
        TextView canpin1=(TextView)popupWindowView.findViewById(R.id.canpin1);
        TextView canpin2=(TextView)popupWindowView.findViewById(R.id.canpin2);
        TextView canpin3=(TextView)popupWindowView.findViewById(R.id.canpin3);
        TextView canpin4=(TextView)popupWindowView.findViewById(R.id.canpin4);
        TextView canpin5=(TextView)popupWindowView.findViewById(R.id.canpin5);
        TextView canpin6=(TextView)popupWindowView.findViewById(R.id.canpin6);
        TextView canpingengduo=(TextView)popupWindowView.findViewById(R.id.canpin_gengduo);
        GridViewForScrollView canpin_gd=(GridViewForScrollView)popupWindowView.findViewById(R.id.canpin_gd);

        TextView canpin_data=(TextView)popupWindowView.findViewById(R.id.canpin_data);
        TextView banji=(TextView)popupWindowView.findViewById(R.id.banji);
        TextView banji1=(TextView)popupWindowView.findViewById(R.id.banji1);
        TextView banji2=(TextView)popupWindowView.findViewById(R.id.banji2);
        TextView banji3=(TextView)popupWindowView.findViewById(R.id.banji3);

        Button chongzhi=(Button)popupWindowView.findViewById(R.id.chongzhi);
        Button wancheng=(Button)popupWindowView.findViewById(R.id.wancheng);

        zhouji.setText("");
        time.setText("");
        banji.setText("");
        canpin.setText("");
        xueqi.setText("");
        jiage.setText("");
        nianji.setText("");
        if(!sxcz.equals("从附近点击")){

            canpinmaosu.setVisibility(View.GONE);
            rlxueqi.setVisibility(View.GONE);
        }
        if(xqxy.equals("显示")){
            ll_xueqi.setVisibility(View.GONE);
        }else{
            ll_xueqi.setVisibility(View.GONE);
        }
        chongzhi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                fl_week.setVisibility(View.GONE);
                ll_week.setVisibility(View.VISIBLE);
                ll_time.setVisibility(View.GONE);
                fl_time.setVisibility(View.GONE);
                zhouji.setText("");
                time.setText("");//时间重置

                banji.setText("");
                fl_banji.setVisibility(View.GONE);
                ll_banji.setVisibility(View.VISIBLE);

                if(sxcz.equals("从附近点击")){

                    ll_canpin.setVisibility(View.GONE);

                    ll_xueqi.setVisibility(View.GONE);

                }
                xueqi.setText("");
                fl_xueqi.setVisibility(View.GONE);
                canpin.setText("");
                canpin_gd.setVisibility(View.GONE);
                fl_canpin.setVisibility(View.GONE);

                ll_canpin.setVisibility(View.GONE);
                canpingengduo.setVisibility(View.GONE);


                jiage.setText("");
                fl_jiage.setVisibility(View.GONE);
                ll_jiage.setVisibility(View.VISIBLE);

                nianji.setText("");
//                fl_nianji.setVisibility(View.GONE);
//                ll_nianji.setVisibility(View.VISIBLE);
//                nianji_gd.setVisibility(View.GONE);


            }
        });

        wancheng.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String times = null;
                String jiages=null;
                String xueqis=null;
                String banjis=null;
                if(time.getText().toString().equals("8:00之前")){
                    times="1";
                }else if(time.getText().toString().equals("8:00-10:00")){
                    times="2";
                }else if(time.getText().toString().equals("10:00-13:00")){
                    times="3";
                }else if(time.getText().toString().equals("13:00-15:00")){
                    times="4";
                }else if(time.getText().toString().equals("15:00-18:00")){
                    times="5";
                }else if(time.getText().toString().equals("18:00之后")){

                    times="6";

                }

                if(jiage.getText().toString().equals("0-100元")){

                    jiages="1";
                }else if(jiage.getText().toString().equals("100-1000元")){

                    jiages="2";
                }else if(jiage.getText().toString().equals("1000-3000元")){

                    jiages="3";
                }else if(jiage.getText().toString().equals("3000元以上")){

                    jiages="4";
                }

                if(xueqi.getText().toString().equals("寒假班")){

                    xueqis="1";
                }else if(xueqi.getText().toString().equals("春季班")){

                    xueqis="2";
                }else if(xueqi.getText().toString().equals("暑期班")){

                    xueqis="3";
                }else if(xueqi.getText().toString().equals("秋季班")){

                    xueqis="4";
                }


                if(banji.getText().toString().equals("15人以下")){
                    banjis="1";
                }else if(banji.getText().toString().equals("15-25人")){

                    banjis="2";
                }else if(banji.getText().toString().equals("25人以上")){

                    banjis="3";
                }
                courseListFragment.loadCourses("不在清理数据2",null,null,null,jgid,sid,zhouji.getText().toString(),times,nianjiid.getText().toString(),jiages
                        ,xueqis,banjis,null,canpin_data.getText().toString());


                popupWindow.dismiss();
            }
        });


        zhouri.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                zhouji.setText("星期日");
                fl_week.setVisibility(View.VISIBLE);
                ll_time.setVisibility(View.VISIBLE);
                ll_week.setVisibility(View.GONE);
            }
        });
        zhouliu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                zhouji.setText("星期六");
                fl_week.setVisibility(View.VISIBLE);
                ll_week.setVisibility(View.GONE);
                ll_time.setVisibility(View.VISIBLE);
            }
        });

        zhouyi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                zhouji.setText("星期一");
                fl_week.setVisibility(View.VISIBLE);
                ll_week.setVisibility(View.GONE);
                ll_time.setVisibility(View.VISIBLE);
            }
        });
        zhouer.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                zhouji.setText("星期二");
                fl_week.setVisibility(View.VISIBLE);
                ll_week.setVisibility(View.GONE);
                ll_time.setVisibility(View.VISIBLE);
            }
        });

        zhousan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                zhouji.setText("星期三");
                fl_week.setVisibility(View.VISIBLE);
                ll_week.setVisibility(View.GONE);
                ll_time.setVisibility(View.VISIBLE);
            }
        });
        zhousi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                zhouji.setText("星期四");
                fl_week.setVisibility(View.VISIBLE);
                ll_week.setVisibility(View.GONE);
                ll_time.setVisibility(View.VISIBLE);
            }
        });

        zhouwu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                zhouji.setText("星期五");
                fl_week.setVisibility(View.VISIBLE);
                ll_week.setVisibility(View.GONE);
                ll_time.setVisibility(View.VISIBLE);
            }
        });
        zhouji.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                fl_week.setVisibility(View.GONE);
                ll_week.setVisibility(View.VISIBLE);
                ll_time.setVisibility(View.GONE);
                fl_time.setVisibility(View.GONE);
                zhouji.setText("");
                time.setText("");
            }
        });
      shijian1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              time.setText("8:00之前");
              ll_time.setVisibility(View.GONE);
              fl_time.setVisibility(View.VISIBLE);
          }
      });
        shijian2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                time.setText("8:00-10:00");
                ll_time.setVisibility(View.GONE);
                fl_time.setVisibility(View.VISIBLE);
            }
        });
        shijian3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                time.setText("10:00-13:00");
                ll_time.setVisibility(View.GONE);
                fl_time.setVisibility(View.VISIBLE);
            }
        });
        shijian4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                time.setText("13:00-15:00");
                ll_time.setVisibility(View.GONE);
                fl_time.setVisibility(View.VISIBLE);
            }
        });
        shijian5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                time.setText("15:00-18:00");
                ll_time.setVisibility(View.GONE);
                fl_time.setVisibility(View.VISIBLE);
            }
        });
        shijian6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                time.setText("18:00之后");
                ll_time.setVisibility(View.GONE);
                fl_time.setVisibility(View.VISIBLE);
            }
        });
        time.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ll_time.setVisibility(View.VISIBLE);
                fl_time.setVisibility(View.GONE);
                time.setText("");
            }
        });

        String temp= PreferenceManager.getDefaultSharedPreferences(getMyAct()).getString("GradeIds",
                "");
       String gradeids=temp.substring(1, temp.length() - 1);


        XApplication application = (XApplication) getActivity().getApplication();


        if (!application.isLogin()) {


            List<String> list=new ArrayList<String>();
            List<String> listid=new ArrayList<String>();
            SharedPreferences preferences=getContext().getSharedPreferences("userInfo", Context.MODE_PRIVATE);
            list.clear();
            int size = preferences.getInt("Status_size", 0);

            for(int i=0;i<size;i++) {
                list.add(preferences.getString("Status" + i, null));
                listid.add(preferences.getString("StatusID" + i, null));
            }
            NinajiBneDiAdapter adapter2=new NinajiBneDiAdapter(getActivity(),list);
            nianji_gd.setAdapter(adapter2);
            nianji_gd.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                    nianji.setText(list.get(position));
//                          ll_nianji.setVisibility(View.GONE);
                    fl_nianji.setVisibility(View.VISIBLE);
                    nianji_gd.setVisibility(View.GONE);
                    nianjiid.setText(listid.get(position));

                }
            });
            chuyi.setText("");
            chuer.setText("");
            chusan.setText("");
            gaoyi.setText("");
            gaoer.setText("");
            gaosan.setText("");
            chuyi.setVisibility(View.GONE);
            chuer.setVisibility(View.GONE);
            chusan.setVisibility(View.GONE);
            gaoyi.setVisibility(View.GONE);
            gaoer.setVisibility(View.GONE);
            gaosan.setVisibility(View.GONE);


            if (list.size() == 1) {
                chuyi.setText(list.get(0));
                chuyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(0));
                        nianji.setText(chuyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuyi.setVisibility(View.VISIBLE);
                chuer.setVisibility(View.GONE);
                chusan.setVisibility(View.GONE);
                gaoyi.setVisibility(View.GONE);
                gaoer.setVisibility(View.GONE);
                chusan.setVisibility(View.GONE);
            } else if (list.size() == 2) {
                chuyi.setText(list.get(0));
                chuer.setText(list.get(1));
                chuyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(0));
                        nianji.setText(chuyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuer.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(1));
                        nianji.setText(chuer.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });

                chuyi.setVisibility(View.VISIBLE);
                chuer.setVisibility(View.VISIBLE);

                chusan.setVisibility(View.GONE);
                gaoyi.setVisibility(View.GONE);
                gaoer.setVisibility(View.GONE);
                chusan.setVisibility(View.GONE);
            } else if (list.size() == 3) {
                chuyi.setText(list.get(0));
                chuer.setText(list.get(1));
                chusan.setText(list.get(2));
                chuyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(0));
                        nianji.setText(chuyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuer.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(1));
                        nianji.setText(chuer.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chusan.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(2));
                        nianji.setText(chusan.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuyi.setVisibility(View.VISIBLE);
                chuer.setVisibility(View.VISIBLE);
                chusan.setVisibility(View.VISIBLE);

                gaoyi.setVisibility(View.GONE);
                gaoer.setVisibility(View.GONE);
                chusan.setVisibility(View.GONE);
            } else if (list.size() == 4) {
                chuyi.setText(list.get(0));
                chuer.setText(list.get(1));
                chusan.setText(list.get(2));
                gaoyi.setText(list.get(3));
                chuyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(0));
                        nianji.setText(chuyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuer.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(1));
                        nianji.setText(chuer.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chusan.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(2));
                        nianji.setText(chusan.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                gaoyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(3));
                        nianji.setText(gaoyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuyi.setVisibility(View.VISIBLE);
                chuer.setVisibility(View.VISIBLE);
                chusan.setVisibility(View.VISIBLE);
                gaoyi.setVisibility(View.VISIBLE);


                gaoer.setVisibility(View.GONE);
                chusan.setVisibility(View.GONE);
            } else if (list.size() == 5) {
                chuyi.setText(list.get(0));
                chuer.setText(list.get(1));
                chusan.setText(list.get(2));
                gaoyi.setText(list.get(3));
                gaoer.setText(list.get(4));
                chuyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(0));
                        nianji.setText(chuyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuer.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(1));
                        nianji.setText(chuer.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chusan.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(2));
                        nianji.setText(chusan.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                gaoyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(3));
                        nianji.setText(gaoyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                gaoer.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(4));
                        nianji.setText(gaoer.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });

                chuyi.setVisibility(View.VISIBLE);
                chuer.setVisibility(View.VISIBLE);
                chusan.setVisibility(View.VISIBLE);
                gaoyi.setVisibility(View.VISIBLE);
                gaoer.setVisibility(View.VISIBLE);


                chusan.setVisibility(View.GONE);
            } else if (list.size() != 0) {
                chuyi.setText(list.get(0));
                chuer.setText(list.get(1));
                chusan.setText(list.get(2));
                gaoyi.setText(list.get(3));
                gaoer.setText(list.get(4));
                gaosan.setText(list.get(5));
                chuyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(0));
                        nianji.setText(chuyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuer.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(1));
                        nianji.setText(chuer.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chusan.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(2));
                        nianji.setText(chusan.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                gaoyi.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(3));
                        nianji.setText(gaoyi.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                gaoer.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(4));
                        nianji.setText(gaoer.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                gaosan.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        nianjiid.setText(listid.get(5));
                        nianji.setText(gaosan.getText().toString());
                        ll_nianji.setVisibility(View.GONE);
                        fl_nianji.setVisibility(View.VISIBLE);
                    }
                });
                chuyi.setVisibility(View.VISIBLE);
                chuer.setVisibility(View.VISIBLE);
                chusan.setVisibility(View.VISIBLE);
                gaoyi.setVisibility(View.VISIBLE);
                gaoer.setVisibility(View.VISIBLE);
                gaosan.setVisibility(View.VISIBLE);
            }



        } else {

            OkHttpClientManager ok=new OkHttpClientManager();
        Map<String,String> map=new HashMap<String,String>();
        map.put("gradeids", gradeids);
        ok.getAsyn(getActivity(), Config.BASE_URL + "app/course/search_grades_list", map, new AjaxCallBack() {
            @Override
            public void onSucces(String response) throws Exception {

                NianJi nj = new Gson().fromJson(response, NianJi.class);

                chuyi.setText("");
                chuer.setText("");
                chusan.setText("");
                gaoyi.setText("");
                gaoer.setText("");
                gaosan.setText("");
                chuyi.setVisibility(View.GONE);
                chuer.setVisibility(View.GONE);
                chusan.setVisibility(View.GONE);
                gaoyi.setVisibility(View.GONE);
                gaoer.setVisibility(View.GONE);
                gaosan.setVisibility(View.GONE);


                if (nj.getGrade().size() == 1) {
                    chuyi.setText(nj.getGrade().get(0).getGradeName());
                    chuyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(0).getGradeId());
                            nianji.setText(chuyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuyi.setVisibility(View.VISIBLE);
                    chuer.setVisibility(View.GONE);
                    chusan.setVisibility(View.GONE);
                    gaoyi.setVisibility(View.GONE);
                    gaoer.setVisibility(View.GONE);
                    chusan.setVisibility(View.GONE);
                } else if (nj.getGrade().size() == 2) {
                    chuyi.setText(nj.getGrade().get(0).getGradeName());
                    chuer.setText(nj.getGrade().get(1).getGradeName());
                    chuyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(0).getGradeId());
                            nianji.setText(chuyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuer.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(1).getGradeId());
                            nianji.setText(chuer.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });

                    chuyi.setVisibility(View.VISIBLE);
                    chuer.setVisibility(View.VISIBLE);

                    chusan.setVisibility(View.GONE);
                    gaoyi.setVisibility(View.GONE);
                    gaoer.setVisibility(View.GONE);
                    chusan.setVisibility(View.GONE);
                } else if (nj.getGrade().size() == 3) {
                    chuyi.setText(nj.getGrade().get(0).getGradeName());
                    chuer.setText(nj.getGrade().get(1).getGradeName());
                    chusan.setText(nj.getGrade().get(2).getGradeName());
                    chuyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(0).getGradeId());
                            nianji.setText(chuyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuer.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(1).getGradeId());
                            nianji.setText(chuer.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chusan.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(2).getGradeId());
                            nianji.setText(chusan.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuyi.setVisibility(View.VISIBLE);
                    chuer.setVisibility(View.VISIBLE);
                    chusan.setVisibility(View.VISIBLE);

                    gaoyi.setVisibility(View.GONE);
                    gaoer.setVisibility(View.GONE);
                    chusan.setVisibility(View.GONE);
                } else if (nj.getGrade().size() == 4) {
                    chuyi.setText(nj.getGrade().get(0).getGradeName());
                    chuer.setText(nj.getGrade().get(1).getGradeName());
                    chusan.setText(nj.getGrade().get(2).getGradeName());
                    gaoyi.setText(nj.getGrade().get(3).getGradeName());
                    chuyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(0).getGradeId());
                            nianji.setText(chuyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuer.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(1).getGradeId());
                            nianji.setText(chuer.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chusan.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(2).getGradeId());
                            nianji.setText(chusan.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    gaoyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(3).getGradeId());
                            nianji.setText(gaoyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuyi.setVisibility(View.VISIBLE);
                    chuer.setVisibility(View.VISIBLE);
                    chusan.setVisibility(View.VISIBLE);
                    gaoyi.setVisibility(View.VISIBLE);


                    gaoer.setVisibility(View.GONE);
                    chusan.setVisibility(View.GONE);
                } else if (nj.getGrade().size() == 5) {
                    chuyi.setText(nj.getGrade().get(0).getGradeName());
                    chuer.setText(nj.getGrade().get(1).getGradeName());
                    chusan.setText(nj.getGrade().get(2).getGradeName());
                    gaoyi.setText(nj.getGrade().get(3).getGradeName());
                    gaoer.setText(nj.getGrade().get(4).getGradeName());
                    chuyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(0).getGradeId());
                            nianji.setText(chuyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuer.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(1).getGradeId());
                            nianji.setText(chuer.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chusan.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(2).getGradeId());
                            nianji.setText(chusan.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    gaoyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(3).getGradeId());
                            nianji.setText(gaoyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    gaoer.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(4).getGradeId());
                            nianji.setText(gaoer.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });

                    chuyi.setVisibility(View.VISIBLE);
                    chuer.setVisibility(View.VISIBLE);
                    chusan.setVisibility(View.VISIBLE);
                    gaoyi.setVisibility(View.VISIBLE);
                    gaoer.setVisibility(View.VISIBLE);


                    chusan.setVisibility(View.GONE);
                } else if (nj.getGrade().size() != 0) {
                    chuyi.setText(nj.getGrade().get(0).getGradeName());
                    chuer.setText(nj.getGrade().get(1).getGradeName());
                    chusan.setText(nj.getGrade().get(2).getGradeName());
                    gaoyi.setText(nj.getGrade().get(3).getGradeName());
                    gaoer.setText(nj.getGrade().get(4).getGradeName());
                    gaosan.setText(nj.getGrade().get(5).getGradeName());
                    chuyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(0).getGradeId());
                            nianji.setText(chuyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuer.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(1).getGradeId());
                            nianji.setText(chuer.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chusan.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(2).getGradeId());
                            nianji.setText(chusan.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    gaoyi.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(3).getGradeId());
                            nianji.setText(gaoyi.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    gaoer.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(4).getGradeId());
                            nianji.setText(gaoer.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    gaosan.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            nianjiid.setText(nj.getGrade().get(5).getGradeId());
                            nianji.setText(gaosan.getText().toString());
                            ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                        }
                    });
                    chuyi.setVisibility(View.VISIBLE);
                    chuer.setVisibility(View.VISIBLE);
                    chusan.setVisibility(View.VISIBLE);
                    gaoyi.setVisibility(View.VISIBLE);
                    gaoer.setVisibility(View.VISIBLE);
                    gaosan.setVisibility(View.VISIBLE);
                }




                     NianJiAdapter adapter = new NianJiAdapter(getActivity(), nj.getGrade());
                    nianji_gd.setAdapter(adapter);
                    nianji_gd.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                            nianji.setText(nj.getGrade().get(position).getGradeName());
//                           ll_nianji.setVisibility(View.GONE);
                            fl_nianji.setVisibility(View.VISIBLE);
                            nianji_gd.setVisibility(View.GONE);
                            nianjiid.setText(nj.getGrade().get(position).getGradeId());

                        }
                    });





            }

            @Override
            public void onFail(String response) {

            }
        });

        }

        nianji_gengduo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                ll_nianji.setVisibility(View.GONE);
                fl_nianji.setVisibility(View.GONE);
                nianji_gd.setVisibility(View.VISIBLE);
            }
        });

        nianji.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                nianji.setText("");
                fl_nianji.setVisibility(View.GONE);
                ll_nianji.setVisibility(View.VISIBLE);
                nianji_gd.setVisibility(View.GONE);
            }
        });

        jiage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiage.setText("");
                fl_jiage.setVisibility(View.GONE);
                ll_jiage.setVisibility(View.VISIBLE);

            }
        });
        jiage1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiage.setText(jiage1.getText().toString());
                fl_jiage.setVisibility(View.VISIBLE);
                ll_jiage.setVisibility(View.GONE);

            }
        });
        jiage2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiage.setText(jiage2.getText().toString());
                fl_jiage.setVisibility(View.VISIBLE);
                ll_jiage.setVisibility(View.GONE);

            }
        });
        jiage3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiage.setText(jiage3.getText().toString());
                fl_jiage.setVisibility(View.VISIBLE);
                ll_jiage.setVisibility(View.GONE);

            }
        });
        jiage4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiage.setText(jiage4.getText().toString());
                fl_jiage.setVisibility(View.VISIBLE);
                ll_jiage.setVisibility(View.GONE);

            }
        });
        xueqi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                xueqi.setText("");
                fl_xueqi.setVisibility(View.GONE);
                ll_xueqi.setVisibility(View.VISIBLE);
                canpingengduo.setVisibility(View.GONE);
                ll_canpin.setVisibility(View.GONE);
                canpin_gd.setVisibility(View.GONE);
            }
        });
        final int[] xueqiid = new int[1];
        xueqi1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              xueqiid[0]=1;
                xueqi.setText(xueqi1.getText().toString());
                fl_xueqi.setVisibility(View.VISIBLE);
                ll_xueqi.setVisibility(View.GONE);

                canpinmaosu.setVisibility(View.VISIBLE);

                 ll_canpin.setVisibility(View.VISIBLE);
                OkHttpClientManager ok=new OkHttpClientManager();
                Map<String,String> map=new HashMap<String, String>();
                map.put("agency_id", "1");
                map.put("semesterid","1");
                ok.getAsyn(getActivity(), Config.BASE_URL + "app/course/search_screensemester_list", map, new AjaxCallBack() {
                    @Override
                    public void onSucces(String response) throws Exception {


                        CanPin canPin=new Gson().fromJson(response,CanPin.class);
                        canpingengduo.setVisibility(View.VISIBLE);
                        canpin_gd.setVisibility(View.GONE);
                        canpin1.setVisibility(View.GONE);
                        canpin2.setVisibility(View.GONE);
                        canpin3.setVisibility(View.GONE);
                        canpin4.setVisibility(View.GONE);
                        canpin5.setVisibility(View.GONE);
                        canpin6.setVisibility(View.GONE);


                        if(canPin.getProduct().size()==1){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);


                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin1.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()==2){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());

                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });

                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                        } else if(canPin.getProduct().size()==3){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                        } else if(canPin.getProduct().size()==4){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());

                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()==5){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());
                            canpin5.setText(canPin.getProduct().get(4).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin5.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin5.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(4).getSemester().getId());
                                }
                            });


                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                            canpin5.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()!=0){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());
                            canpin5.setText(canPin.getProduct().get(4).getSemester().getProductName());
                            canpin6.setText(canPin.getProduct().get(5).getSemester().getProductName());
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                            canpin5.setVisibility(View.VISIBLE);
                            canpin6.setVisibility(View.VISIBLE);
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin5.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin5.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(4).getSemester().getId());
                                }
                            });
                            canpin6.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin6.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(5).getSemester().getId());
                                }
                            });


                        }else if(canPin.getProduct().size()<1){
                            ll_canpin.setVisibility(View.GONE);
                        }

                    }

                    @Override
                    public void onFail(String response) {

                    }
                });
            }
        });
        xueqi2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                xueqiid[0]=2;
                xueqi.setText(xueqi2.getText().toString());
                fl_xueqi.setVisibility(View.VISIBLE);
                ll_xueqi.setVisibility(View.GONE);
                canpinmaosu.setVisibility(View.VISIBLE);
                ll_canpin.setVisibility(View.VISIBLE);
                canpin_gd.setVisibility(View.GONE);
                OkHttpClientManager ok=new OkHttpClientManager();
                Map<String,String> map=new HashMap<String, String>();
                map.put("agency_id", "1");
                map.put("semesterid","2");
                ok.getAsyn(getActivity(), Config.BASE_URL + "app/course/search_screensemester_list", map, new AjaxCallBack() {
                    @Override
                    public void onSucces(String response) throws Exception {

                        CanPin canPin=new Gson().fromJson(response,CanPin.class);
                         canpingengduo.setVisibility(View.VISIBLE);


                        canpin1.setVisibility(View.GONE);
                        canpin2.setVisibility(View.GONE);
                        canpin3.setVisibility(View.GONE);
                        canpin4.setVisibility(View.GONE);
                        canpin5.setVisibility(View.GONE);
                        canpin6.setVisibility(View.GONE);

                        if(canPin.getProduct().size()==1){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);



                                    canpin_data.setText(String.valueOf(canPin.getProduct().get(0).getSemester().getId()));
                                }
                            });
                            canpin1.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()==2){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());

                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });

                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                        } else if(canPin.getProduct().size()==3){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                        } else if(canPin.getProduct().size()==4){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());

                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()==5){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());
                            canpin5.setText(canPin.getProduct().get(4).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin5.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin5.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(4).getSemester().getId());
                                }
                            });


                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                            canpin5.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()!=0){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());
                            canpin5.setText(canPin.getProduct().get(4).getSemester().getProductName());
                            canpin6.setText(canPin.getProduct().get(5).getSemester().getProductName());
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                            canpin5.setVisibility(View.VISIBLE);
                            canpin6.setVisibility(View.VISIBLE);
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);


                                    canpin_data.setText(String.valueOf(canPin.getProduct().get(0).getSemester().getId()));
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin5.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin5.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(4).getSemester().getId());
                                }
                            });
                            canpin6.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin6.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(5).getSemester().getId());
                                }
                            });


                        }else if(canPin.getProduct().size()<1){
                            ll_canpin.setVisibility(View.GONE);
                        }

                    }

                    @Override
                    public void onFail(String response) {

                    }
                });
            }
        });
        xueqi3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                xueqi.setText(xueqi3.getText().toString());
                fl_xueqi.setVisibility(View.VISIBLE);
                ll_xueqi.setVisibility(View.GONE);
                canpinmaosu.setVisibility(View.VISIBLE);
                canpin_gd.setVisibility(View.GONE);

                ll_canpin.setVisibility(View.VISIBLE);
                OkHttpClientManager ok = new OkHttpClientManager();
                Map<String, String> map = new HashMap<String, String>();
                map.put("agency_id", "1");
                map.put("semesterid", "3");
                ok.getAsyn(getActivity(), Config.BASE_URL + "app/course/search_screensemester_list", map, new AjaxCallBack() {
                    @Override
                    public void onSucces(String response) throws Exception {
                        canpingengduo.setVisibility(View.VISIBLE);
                        xueqiid[0] = 3;
                        CanPin canPin = new Gson().fromJson(response, CanPin.class);

                        canpin1.setVisibility(View.GONE);
                        canpin2.setVisibility(View.GONE);
                        canpin3.setVisibility(View.GONE);
                        canpin4.setVisibility(View.GONE);
                        canpin5.setVisibility(View.GONE);
                        canpin6.setVisibility(View.GONE);



                        if(canPin.getProduct().size()==1){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin1.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()==2){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());

                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });

                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                        } else if(canPin.getProduct().size()==3){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                        } else if(canPin.getProduct().size()==4){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());

                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()==5){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());
                            canpin5.setText(canPin.getProduct().get(4).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin5.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin5.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(4).getSemester().getId());
                                }
                            });


                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                            canpin5.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()!=0){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());
                            canpin5.setText(canPin.getProduct().get(4).getSemester().getProductName());
                            canpin6.setText(canPin.getProduct().get(5).getSemester().getProductName());
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                            canpin5.setVisibility(View.VISIBLE);
                            canpin6.setVisibility(View.VISIBLE);
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin5.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin5.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(4).getSemester().getId());
                                }
                            });
                            canpin6.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin6.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(5).getSemester().getId());
                                }
                            });


                        }else if(canPin.getProduct().size()<1){
                            ll_canpin.setVisibility(View.GONE);
                        }

                    }

                    @Override
                    public void onFail(String response) {

                    }
                });
            }
        });

        xueqi4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                xueqiid[0] = 4;
                canpingengduo.setVisibility(View.VISIBLE);
                xueqi.setText(xueqi4.getText().toString());
                fl_xueqi.setVisibility(View.VISIBLE);
                ll_xueqi.setVisibility(View.GONE);
                canpinmaosu.setVisibility(View.VISIBLE);
                canpin_gd.setVisibility(View.GONE);
                ll_canpin.setVisibility(View.VISIBLE);
                OkHttpClientManager ok = new OkHttpClientManager();
                Map<String, String> map = new HashMap<String, String>();
               map.put("agency_id", "1");

                map.put("semesterid", "4");
                ok.getAsyn(getActivity(), Config.BASE_URL + "app/course/search_screensemester_list", map, new AjaxCallBack() {
                    @Override
                    public void onSucces(String response) throws Exception {

                        CanPin canPin = new Gson().fromJson(response, CanPin.class);

                        canpin1.setVisibility(View.GONE);
                        canpin2.setVisibility(View.GONE);
                        canpin3.setVisibility(View.GONE);
                        canpin4.setVisibility(View.GONE);
                        canpin5.setVisibility(View.GONE);
                        canpin6.setVisibility(View.GONE);



                        if(canPin.getProduct().size()==1){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin1.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()==2){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());

                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });

                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                        } else if(canPin.getProduct().size()==3){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                        } else if(canPin.getProduct().size()==4){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());

                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()==5){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());
                            canpin5.setText(canPin.getProduct().get(4).getSemester().getProductName());
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin5.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin5.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(4).getSemester().getId());
                                }
                            });


                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                            canpin5.setVisibility(View.VISIBLE);
                        }else if(canPin.getProduct().size()!=0){
                            canpin1.setText(canPin.getProduct().get(0).getSemester().getProductName());
                            canpin2.setText(canPin.getProduct().get(1).getSemester().getProductName());
                            canpin3.setText(canPin.getProduct().get(2).getSemester().getProductName());
                            canpin4.setText(canPin.getProduct().get(3).getSemester().getProductName());
                            canpin5.setText(canPin.getProduct().get(4).getSemester().getProductName());
                            canpin6.setText(canPin.getProduct().get(5).getSemester().getProductName());
                            canpin1.setVisibility(View.VISIBLE);
                            canpin2.setVisibility(View.VISIBLE);
                            canpin3.setVisibility(View.VISIBLE);
                            canpin4.setVisibility(View.VISIBLE);
                            canpin5.setVisibility(View.VISIBLE);
                            canpin6.setVisibility(View.VISIBLE);
                            canpin1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin1.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(0).getSemester().getId());
                                }
                            });
                            canpin2.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin2.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(1).getSemester().getId());
                                }
                            });
                            canpin3.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin3.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(2).getSemester().getId());
                                }

                            });
                            canpin4.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin4.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(3).getSemester().getId());
                                }
                            });
                            canpin5.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin5.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(4).getSemester().getId());
                                }
                            });
                            canpin6.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    canpin.setText(canpin6.getText().toString());
                                    canpin_gd.setVisibility(View.GONE);
                                    fl_canpin.setVisibility(View.VISIBLE);
                                    ll_canpin.setVisibility(View.GONE);
                                    canpin_data.setText(canPin.getProduct().get(5).getSemester().getId());
                                }
                            });


                        }else if(canPin.getProduct().size()<1){
                            ll_canpin.setVisibility(View.GONE);
                        }


                    }

                    @Override
                    public void onFail(String response) {

                    }
                });
            }
        });

        canpingengduo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                canpin_gd.setVisibility(View.VISIBLE);
                fl_canpin.setVisibility(View.GONE);
                ll_canpin.setVisibility(View.GONE);

                OkHttpClientManager ok=new OkHttpClientManager();
                Map<String,String> map=new HashMap<String, String>();
                map.put("agency_id", "1");


                    map.put("semesterid", "2");

                ok.getAsyn(getActivity(), Config.BASE_URL + "app/course/search_screensemester_list", map, new AjaxCallBack() {
                    @Override
                    public void onSucces(String response) throws Exception {

                        CanPin canPin = new Gson().fromJson(response, CanPin.class);
                        CanPinAdapter adapter = new CanPinAdapter(getActivity(), canPin.getProduct());
                        canpin_gd.setAdapter(adapter);
                        canpin_gd.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                            @Override
                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                                canpin.setText(canPin.getProduct().get(position).getSemester().getProductName());
                                ll_canpin.setVisibility(View.GONE);
                                fl_canpin.setVisibility(View.VISIBLE);
                                canpin_gd.setVisibility(View.GONE);
                                canpin_data.setText(canPin.getProduct().get(position).getSemester().getId());
                            }
                        });

                    }

                    @Override
                    public void onFail(String response) {

                    }

                });

            }
        });
        canpin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                canpin_gd.setVisibility(View.GONE);
                fl_canpin.setVisibility(View.GONE);
                ll_canpin.setVisibility(View.VISIBLE);
                canpin.setText("");

            }
        });






        banji.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                banji.setText("");
                fl_banji.setVisibility(View.GONE);
                ll_banji.setVisibility(View.VISIBLE);

            }
        });
        banji1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                banji.setText(banji1.getText().toString());
                fl_banji.setVisibility(View.VISIBLE);
                ll_banji.setVisibility(View.GONE);
            }
        });
        banji2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                banji.setText(banji2.getText().toString());
                fl_banji.setVisibility(View.VISIBLE);
                ll_banji.setVisibility(View.GONE);
            }
        });
        banji3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                banji.setText(banji3.getText().toString());
                fl_banji.setVisibility(View.VISIBLE);
                ll_banji.setVisibility(View.GONE);
            }
        });

    }

    /**
     * 设置添加屏幕的背景透明度
     * @param bgAlpha
     */
    public void backgroundAlpha(float bgAlpha)
    {
        WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes();
        lp.alpha = bgAlpha; //0.0-1.0
        getActivity().getWindow().setAttributes(lp);
    }

    /**
         * 科目点击事件
         *
         * @param view
         */
        public void onArtSportMenuClick(View view) {

//            artmenuOptions0.clear();

//             }
//            if (null == artSportMenu || !artSportMenu.isShowing()) {
                //设置筛选标题颜色
//                cultureTitle.setTextColor(getResources().getColor(R.color.rvcode));
//                cultureIcon.setImageResource(R.mipmap.ico_green_top_arrow);

                //选项三级数据
                View courseFilterMenuView = getMyAct().getLayoutInflater().inflate(R.layout.layout_course_filter_menu, null, false);
                artSportMenu = new PopupWindow(courseFilterMenuView, LinearLayout.LayoutParams.MATCH_PARENT,
                        708);
                artSportMenu.setOutsideTouchable(true);
                artSportMenu.setFocusable(true);
                artSportMenu.setBackgroundDrawable(new BitmapDrawable());

            artSportMenu.setOnDismissListener(new PopupWindow.OnDismissListener() {
                @Override
                public void onDismiss() {
                    cultureTitle.setTextColor(Color.parseColor("#000000"));
                    cultureIcon.setImageResource(R.mipmap.ic_course_search_arrow_down);
                }
            });

            final ListView artSportOption0ListView = (ListView) courseFilterMenuView.findViewById(R.id.data_list0);
            final ListView artSportOption1ListView = (ListView) courseFilterMenuView.findViewById(R.id.data_list1);
            final ListView artSportOption2ListView = (ListView) courseFilterMenuView.findViewById(R.id.data_list2);

                final CourseFilterMenuAdapter artSportOption0Adapter = new CourseFilterMenuAdapter(getMyAct(),
                        R.layout.item_course_filter_menu, artmenuOptions0);

            hideLoadingDialog();
                final CourseFilterMenuAdapter artSportOption1Adapter = new CourseFilterMenuAdapter(getMyAct(),
                        R.layout.item_course_filter_menu_grey, null);
                final CourseFilterMenuAdapter artSportOption2Adapter = new CourseFilterMenuAdapter(getMyAct(),
                        R.layout.item_course_filter_menu_grey, null);
            artSportOption0ListView.setAdapter(artSportOption0Adapter);
            artSportOption1ListView.setAdapter(artSportOption1Adapter);
            artSportOption2ListView.setAdapter(artSportOption2Adapter);
//                artSportOption0Adapter.notifyDataSetChanged();
//                artSportOption1Adapter.notifyDataSetChanged();
//                artSportOption2Adapter.notifyDataSetChanged();


               List<String> list2=new ArrayList<>();
                //第一级ListView点击
                try {
                artSportOption0ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        courseListFragment.setname(null);

                        courseListFragment.setleaveType(null);
                        courseListFragment.settypesTwoname(null);
                       if(position!=0) {
                           int type;

                           type = list.get(position - 1).getType();
                           list2.add(String.valueOf(list.get(position - 1).getType()));
                       }
                        if (position == 0) {
                            cultureTitle.setText("全部");
                            levelOneSelected = "0";
                            levelTwoSelected = "0";
                            levelThreeSelected = "0";
                            courseListFragment.gradeids=buffer2.toString();

                            courseListFragment.setLevelOneSelected(null);
                            courseListFragment.setLevelTwoSelected(null);
                            courseListFragment.setLevelThreeSelected(null);
                            courseListFragment.setac("ac");
                            courseListFragment.loadCourses("不在清理数据",null,null,null,null,null,null,null,"353",null,null,null,null,null);
                            artSportMenu.dismiss();
                        } else {

                            for (int i = 0; i < artmenuOptions0.size(); i++) {
                                artmenuOptions0.get(i).checked = false;
                            }
                            oneselected = artmenuOptions0.get(position);

                            if (oneselected.one.getId() != 0) {
                                levelOneSelected = oneselected.one.getId() + "";
                                courseListFragment.setLevelOneSelected(levelOneSelected);
                                courseListFragment.setleaveType(String.valueOf(list.get(position - 1).getType()));

                            } else {
                                levelOneSelected = "0";
                                course_type = "1";
                            }
                            levelTwoSelected = "0";
                            levelThreeSelected = "0";

                            artmenuOptions0.get(position).checked = true;
                            artSportOption0Adapter.notifyDataSetChanged();

                            //第二级
                            if (null != menuOptions1)
                                menuOptions1.clear();
                            else
                                menuOptions1 = new ArrayList<Pair>();

                            if (null == oneselected.one.getTwo() || oneselected.one.getTwo().size() == 0) {// 如果二级筛选为空 直接搜索

                                cultureTitle.setText(oneselected.one.getName());
                                currentFilter = CURRENT_FILTER_ART_APORT;
                                startSearch(false);
                                artSportMenu.dismiss();
                            }else {
                                Pair all = new Pair();
                                all.two = new CourseSearchCriteriaLevelTwoWithOthers();
                                all.two.setSubjectname("全部");
                                all.two.setId(0L);
//                                menuOptions1.add(all);
                                List<CourseSearchCriteriaLevelTwoWithOthers> list_two = oneselected.one.getTwo();

                                for (CourseSearchCriteriaLevelTwoWithOthers ctwo : list_two) {
                                    Pair p = new Pair();
                                    p.two = ctwo;
                                    menuOptions1.add(p);
                                }

                                artSportOption1Adapter.setData(menuOptions1);
                                artSportOption1ListView.setVisibility(View.VISIBLE);
                                if (null != menuOptions2)
                                    menuOptions2.clear();
                                artSportOption2Adapter.setData(menuOptions2);
                                artSportOption2Adapter.notifyDataSetChanged();
                            }
                        }
                    }

                });
                }catch (Exception e){

                }
                //第二级ListView点击
                artSportOption1ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        courseListFragment.setname(null);
//                        if(position==0){
//                            cultureTitle.setText("全部");
//                            courseListFragment.gradeids=buffer2.toString();
//                            levelTwoSelected = "0";
//                            levelThreeSelected = "0";
//                            courseListFragment.setLevelTwoSelected(null);
//                            courseListFragment.setLevelThreeSelected(null);
//                            courseListFragment.setasb("asb");
//                            courseListFragment.loadMoreCourses(Config.BASE_URL + Config.COURSE_RECOMMED_LIST_URL);
//                            artSportMenu.dismiss();
//                        }else{
//                            if(menuOptions1.get(position).){

//                            }
                        for (int i = 0; i < menuOptions1.size(); i++) {
                            menuOptions1.get(i).checked = false;
                        }
                        twoselected = menuOptions1.get(position);
                        if (twoselected.two.getId()!=0) {
                            levelTwoSelected = twoselected.two.getId() + "";

                            courseListFragment.setLevelTwoSelected(levelTwoSelected);
                            if(list2.size()!=0){
                                if(list2.get(list2.size()-1).toString().equals("1")){
                                    courseListFragment.settypesTwoname(twoselected.two.getName());
                                }
                            }
                        }else
                            levelTwoSelected="0";
                            levelThreeSelected = "0";

                        cultureTitle.setText(twoselected.two.getSubjectname());
                        twoselected.checked=true;
                        artSportOption1Adapter.notifyDataSetChanged();
                        if (null!=menuOptions2)
                            menuOptions2.clear();
                        else
                            menuOptions2=new ArrayList<Pair>();



                        if (null==twoselected.two.getThrees()||twoselected.two.getThrees().size()==0){// 如果三级筛选为空 直接搜索

                            cultureTitle.setText(twoselected.two.getSubjectname());
                            //当前筛选项
                            currentFilter = CURRENT_FILTER_ART_APORT;

                            startSearch(false);
                            artSportMenu.dismiss();
                        }else if(list2.size()!=0){
                            if(list2.get(list2.size()-1).toString().equals("1")){

                                cultureTitle.setText(twoselected.two.getSubjectname());
                                //当前筛选项
                                currentFilter = CURRENT_FILTER_ART_APORT;

                                startSearch(false);
                                artSportMenu.dismiss();

                            }else {
                                Pair all=new Pair();
                                all.three=new CourseSearchCriteriaLevelThreeWithOthers();
                                all.three.setId(0L);
                                all.three.setGradename("全部");
                                courseListFragment.gradeids=buffer2.toString();
//                                menuOptions2.add(all);
                                for (CourseSearchCriteriaLevelThreeWithOthers cthree : twoselected.two.getThrees()) {
                                    Pair p = new Pair();
                                    p.three = cthree;
                                    menuOptions2.add(p);
                                }

                                artSportOption2Adapter.setData(menuOptions2);
                                artSportOption1ListView.setVisibility(View.VISIBLE);

                            }
                        }else {
                            Pair all=new Pair();
                            all.three=new CourseSearchCriteriaLevelThreeWithOthers();
                            all.three.setId(0L);
                            all.three.setGradename("全部");
                            menuOptions2.add(all);
                            for (CourseSearchCriteriaLevelThreeWithOthers cthree : twoselected.two.getThrees()) {
                                Pair p = new Pair();
                                p.three = cthree;
                                menuOptions2.add(p);
                            }

                            artSportOption2Adapter.setData(menuOptions2);
                            artSportOption1ListView.setVisibility(View.VISIBLE);

                        }
                    }
                });

                //第三级ListView点击
                artSportOption2ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        courseListFragment.setname(null);
//                        if(position==0){
//                            cultureTitle.setText("全部");
//                            courseListFragment.gradeids=buffer2.toString();
//                            levelThreeSelected = "0";
//                            courseListFragment.setLevelThreeSelected(null);
//                            courseListFragment.setasb("ag");
//                            courseListFragment.loadMoreCourses(Config.BASE_URL+Config.COURSE_RECOMMED_LIST_URL);
//                            artSportMenu.dismiss();
//                        }else{
                        threeselected=menuOptions2.get(position);
                        if (threeselected.three.getId()!=0) {
                            levelThreeSelected = threeselected.three.getName() + "";
                            courseListFragment.setLevelThreeSelected(null);

                            courseListFragment.gradeids=levelThreeSelected;

                            name=threeselected.three.getName()+ "";
                            courseListFragment.setname(name);

//                            courseListFragment.loadCourses("不在清理数据", null, null, null, null, null, null, null, "353", null, null, null, null, null, levelThreeSelected);

                        }else
                            levelTwoSelected="0";
                        threeselected.checked=true;

                        //当前筛选项
                        currentFilter = CURRENT_FILTER_ART_APORT;

                        startSearch(false);

                        artSportMenu.dismiss();
                   }
                });

                artSportMenu.setOnDismissListener(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        cultureTitle.setTextColor(getResources().getColor(android.R.color.secondary_text_light));
                        cultureIcon.setImageResource(R.mipmap.ic_course_search_arrow_down);

                    }
                });

                artSportMenu.showAsDropDown(view, 0, 0);
//            } else {
//                cultureTitle.setTextColor(getResources().getColor(android.R.color.secondary_text_light));
//                cultureIcon.setImageResource(R.mipmap.ic_course_search_arrow_down);
//
//                artSportMenu.dismiss();
//            }

        }

   String xqxy="隐藏";
    /**
     * 附近点击LS
     */
       public void AddressMenuClick(View view){

           View contentView = LayoutInflater.from(getActivity()).inflate(R.layout.item_fujin, null);
           final PopupWindow popupWindow2 = new PopupWindow(contentView,
                   LinearLayout.LayoutParams.MATCH_PARENT, 708);

           popupWindow2.setOutsideTouchable(true);
           popupWindow2.setFocusable(true);
           popupWindow2.setBackgroundDrawable(new BitmapDrawable());

           v.setOnTouchListener(new View.OnTouchListener() {

               @Override
               public boolean onTouch(View v, MotionEvent event) {

                   if(event.getAction()==MotionEvent.ACTION_OUTSIDE){
                       popupWindow2.dismiss();

                       return true;
                   }
                   // 这里如果返回true的话，touch事件将被拦截
                   // 拦截后 PopupWindow的onTouchEvent不被调用，这样点击外部区域无法dismiss
                   return false;
               }
           });
           popupWindow2.setOnDismissListener(new PopupWindow.OnDismissListener() {
               @Override
               public void onDismiss() {
                   tv_fujin.setTextColor(Color.parseColor("#000000"));
                   iv_fujin.setImageResource(R.mipmap.ic_course_search_arrow_down);
               }
           });
           popupWindow2.showAsDropDown(view, 0, 0);

           ListView lv1=(ListView)contentView.findViewById(R.id.fujin_lv1);
           ListView lv2=(ListView)contentView.findViewById(R.id.fujin_lv2);
           ListView lv3=(ListView)contentView.findViewById(R.id.fujin_lv3);
           OkHttpClientManager ok=new OkHttpClientManager();
           Map<String,String> map=new HashMap<String,String>();

           ok.getAsyn(getActivity(), Config.BASE_URL + "app/course/search_screen_list", map, new AjaxCallBack() {
               @Override
               public void onSucces(String response) throws Exception {

                   FuJin fuJin = new Gson().fromJson(response.toString(), FuJin.class);

                   View vgmenu = LayoutInflater.from(getActivity()).inflate(R.layout.item_course_filter_menu, null);

                   lv1.addHeaderView(vgmenu);


                   TextView name = (TextView) vgmenu.findViewById(R.id.name);
                   ImageView icon = (ImageView) vgmenu.findViewById(R.id.icon);

                   FuJinAdapter adapter = new FuJinAdapter(getActivity(), fuJin.getScreen().get(0).getSysAreas());
                   lv1.setAdapter(adapter);

                   lv1.setOnItemClickListener(new AdapterView.OnItemClickListener() {

                       @Override
                       public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                           if (position != 0) {
                               name.setTextColor(Color.parseColor("#000000"));
                               icon.setVisibility(View.GONE);
                               lv3.setVisibility(View.INVISIBLE);
                               adapter.NoAdapter(position - 1, adapter, fuJin.getScreen().get(0).getSysAreas());
                               OkHttpClientManager ok = new OkHttpClientManager();
                               Map<String, String> map1 = new HashMap<String, String>();
                               map1.put("areaId", "" + fuJin.getScreen().get(0).getSysAreas().get(position - 1).getId());

                               ok.getAsyn(getActivity(), Config.BASE_URL + "/app/course/search_screentown_list", map1,
                                       new AjaxCallBack() {
                                           @Override
                                           public void onSucces(String response) throws Exception {

                                               FuJin2 fuJin2 = new Gson().fromJson(response.toString(), FuJin2.class);

                                               TownEntity te=new TownEntity();
                                               te.setName("全部");
                                               fuJin2.getTown().add(te);
                                               List<TownEntity> list2=new ArrayList<TownEntity>();

                                               list2.add( fuJin2.getTown().get(fuJin2.getTown().size() - 1));
                                               for(int i=0;i< fuJin2.getTown().size()-1;i++){
                                                   list2.add(fuJin2.getTown().get(i));
                                               }

                                               FuJin2Adapter adapter1 = new FuJin2Adapter(getActivity(), list2);
                                               lv2.setAdapter(adapter1);

                                               int iddd=fuJin.getScreen().get(0).getSysAreas().get(position-1).getId();

                                               lv2.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                                                   @Override
                                                   public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                                                       adapter1.NoAdapter(position, adapter1, list2);
                                                       tv_fujin.setText(list2.get(position).getName());
                                                       if(position==0){

                                                           courseListFragment.loadCourses("CCC","区全部","" + iddd, null, null, null, null, null, "年级", null, null, null, null, null);
                                                          popupWindow2.dismiss();
                                                      }else{

                                                         schoolId= list2.get(position).getId();
                                                         agencyId=iddd;
                                                          courseListFragment.loadCourses("CCC",null,"" + iddd, "" + list2.get(position).getId(), null, null, null, null, "年级", null, null, null, null,null);
                                                          popupWindow2.dismiss();
                                                      }

                                                   }
                                               });

                                           }

                                           @Override
                                           public void onFail(String response) {

                                           }
                                       });
                           } else {

                               adapter.NoAdapter(position - 1, adapter, fuJin.getScreen().get(0).getSysAreas());
                               name.setTextColor(Color.parseColor("#068600"));
                               icon.setVisibility(View.VISIBLE);
//                               View quanbu = LayoutInflater.from(getActivity()).inflate(R.layout.item_fujin_quanbu, null);
//                               lv2.addHeaderView(quanbu);
                               XiaoQuAdapter adapter1 = new XiaoQuAdapter(getActivity(), fuJin.getScreen().get(0).getListAgenies());
                               lv2.setAdapter(adapter1);

                               lv2.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                               @Override
                               public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                               adapter1.NoAdapter(position, adapter1, fuJin.getScreen().get(0).getListAgenies());
                               lv3.setVisibility(View.VISIBLE);

                              OkHttpClientManager okHttpClientManager = new OkHttpClientManager();
                              Map<String, String> map1 = new HashMap<String, String>();
                                map1.put("agency_id", "" + fuJin.getScreen().get(0).getListAgenies().getId());

                              okHttpClientManager.getAsyn(getActivity(), Config.BASE_URL + "/app/course/search_school_agency", map1, new AjaxCallBack() {
                               @Override
                          public void onSucces(String response) throws Exception {
                                   XiaoQu xiaoQu = new Gson().fromJson(response.toString(), XiaoQu.class);
                                   XiaoQu2Adapter adapter1 = new XiaoQu2Adapter(getActivity(), xiaoQu.getAgencySchools());
                                   lv3.setAdapter(adapter1);

                                   lv3.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                                       @Override
                                       public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                                           adapter1.NoAdapter(position, adapter1, xiaoQu.getAgencySchools());
                                           xqxy = "显示";

                                           tv_fujin.setText(xiaoQu.getAgencySchools().get(position).getName());
                                           courseListFragment.loadCourses("CCC", null, null, null, "" + xiaoQu.getAgencySchools().get(position).getId(), "" + fuJin.getScreen().get(0).getListAgenies().getId(), null, null, "年级", null, null, null, null, null);
                                           sxcz="从附近点击";
                                           jgid=""+xiaoQu.getAgencySchools().get(position).getId();
                                           xqid="" + fuJin.getScreen().get(0).getListAgenies().getId();
                                           initPopupWindow(xqxy, "" + xiaoQu.getAgencySchools().get(position).getId(), "" + fuJin.getScreen().get(0).getListAgenies().getId());
                                           popupWindow2.dismiss();

                                       }
                                   });
                               }

                   @Override
                   public void onFail(String response) {

                   }
               });



                                   }
                               });
                           }
                       }
                   });

               }

               @Override
               public void onFail(String response) {

               }
           });

       }


        /**
         * 筛选按钮点击
         *
         * @param view
         */
        public void onFilterClick(View view) {

            if (null == filterPopupWindow || !filterPopupWindow.isShowing()) {
                WindowManager.LayoutParams lp = getMyAct().getWindow().getAttributes(); // 设置窗体透明度
                lp.alpha = 1.0f;
                getMyAct().getWindow().setAttributes(lp);

                filterPopupWindow = new CourseFilterPopupWindow(getMyAct(),this);
                //filterPopupWindow.setAreaName(currentAreaName);
               // filterPopupWindow.updateSortOption(currentSortOption);

                int location[]=new int[2];
                filter_sort_ll.getLocationInWindow(location);
                //filterPopupWindow.showAtLocation(filter_sort_ll, Gravity.NO_GRAVITY, location[0], location[1]+filterPopupWindow.getHeight());
                filterPopupWindow.showAsDropDown(filter_sort_ll);
                filterPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        WindowManager.LayoutParams lp = getMyAct().getWindow().getAttributes(); // 恢复窗体透明度
                        lp.alpha = 1.0f;
                        getMyAct().getWindow().setAttributes(lp);
                        sortTextView .setTextColor(Color.parseColor("#000000"));
                        sort_iv.setImageResource(R.mipmap.ic_course_search_arrow_down);
                    }
                });
            }
        }

        @Override
        public void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode==SEARCHR_REQUEST_CODE&&resultCode== EditKeyWordActivity.SEARCH_RESULT_CORD ){
                keyword=data.getStringExtra("record");
                keyword_tv.setText(keyword);
                course_type=null;
                startSearch(false);
            }
        }
        int height;
        @Override
        public void onResume() {
            super.onResume();

            advLayoutDailyRecommend.post(new Runnable() {
                @Override
                public void run() {
                    height = advLayoutDailyRecommend.getHeight();
                }
            });


        }


    private RecyclerView.OnScrollListener hildlistener= new MyScroller();
        class MyScroller extends RecyclerView.OnScrollListener implements Animator.AnimatorListener {
            private static final int HIDE_THRESHOLD = 20;
            private int scrolledDistance = 0;
            private boolean controlsVisible = true;

            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                int firstvisitpostion = ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstVisibleItemPosition();
                if (hasrecommed_course) {
                    if (scrolledDistance > HIDE_THRESHOLD && controlsVisible) {
                        // TODO onHide();
                        advLayoutDailyRecommend.setVisibility(View.GONE);
                        controlsVisible = false;
                        scrolledDistance = 0;
                    } else if (scrolledDistance < -HIDE_THRESHOLD && !controlsVisible) {
                        if (0 == firstvisitpostion) {
                            // TODO onShow();
                            showViews(advLayoutDailyRecommend);
                            controlsVisible = true;
                            scrolledDistance = 0;
                        }
                    }
                    if ((controlsVisible && dy > 0) || (!controlsVisible && dy < 0)) {
                        scrolledDistance += dy;
                    }
                }
            }

            private void hideViews(View v1) {
                ObjectAnimator animator_out=ObjectAnimator.ofFloat(v1, "translationY", 0, -height);
                animator_out.addListener(this);
                animator_out.setDuration(300);

                animator_out.start();
            }

            private void showViews(View v1) {
                ObjectAnimator animator_in=ObjectAnimator.ofFloat(v1, "translationY", -height, 0);
                animator_in.addListener(this);
                animator_in.setDuration(500);
                animator_in.start();
            }

            @Override
            public void onAnimationStart(Animator animation) {

            }

            @Override
            public void onAnimationEnd(Animator animation) {
                    if (controlsVisible){
                        advLayoutDailyRecommend.setVisibility(View.VISIBLE);
                    }else {
                        advLayoutDailyRecommend.setVisibility(View.GONE);
                    }
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        }


    private class JumpingBeans {
    }
}

